//
//  MSVideoPlayerView.h
//  MSPhotoBrowser
//
//  Created by zzg on 2021/8/30.
//

#import <UIKit/UIKit.h>
#import <AVFoundation/AVFoundation.h>
#import <AVKit/AVKit.h>





@class MSVideoPlayerView;


typedef NS_ENUM(NSInteger, MSVideoPlayerState) {
//    MSVideoPlayerStateBuffering,
    MSVideoPlayerStateFailed,
    MSVideoPlayerStatePlaying,
    MSVideoPlayerStatePaused,
};

@protocol MSVideoPlayerViewDelegate <NSObject>

@optional

- (void)videoPlayerDidPlay:(MSVideoPlayerView *)videoPlayerView;
- (void)videoPlayerDidPause:(MSVideoPlayerView *)videoPlayerView;
- (void)videoPlayerRemove:(MSVideoPlayerView *)videoPlayerView;
- (void)videoPlayerDownload:(MSVideoPlayerView *)videoPlayerView;

@end





@interface MSVideoPlayerView : UIView



@property (nonatomic, weak) id<MSVideoPlayerViewDelegate> delegate;
@property (nonatomic) MSVideoPlayerState playerState;                     // 默认开始状态是MSVideoPlayerStateFailed
@property (nonatomic) BOOL  loopPlayVideo;                                 //  是否循环播放

- (instancetype)initWithFrame:(CGRect)frame andVideoURL:(NSURL *)videoURL andAutoPlay:(BOOL)autoPlay;
// 暂停
- (void)pauseVideo;
// 播放
- (void)playVideo;
// 销毁
- (void)destroyPlayer;
// 清楚播放器
- (void)removeTheVideoPlayer;
// 更换设置videoURL
- (void)switchWithVideoURL:(NSURL *)videoURL;

/// 设置是否静音播放
/// @param muted muted description
- (void)videoBottomBarDidClickMuted:(BOOL)muted;

@end




